#include <cstdio>
#include <queue>
#include <functional>
using namespace std;

priority_queue<long long, vector<long long>, greater<long long> > q;

int main() {
	int n;
	scanf("%d", &n);
	q.push(2);
	q.push(3);
	q.push(5);
	q.push(7);
	long long lastx = 1, x;
	for (int i = 1; i < n; ++i) {
		x = q.top();
		q.pop();
		if (x == lastx) {
			--i;
			continue;
		}
		if (x % 7 == 0) {
			q.push(x * 7);
		} else if (x % 5 == 0) {
			q.push(x * 7);
			q.push(x * 5);
		} else if (x % 3 == 0) {
			q.push(x * 7);
			q.push(x * 5);
			q.push(x * 3);
		} else if (x % 2 == 0) {
			q.push(x * 7);
			q.push(x * 5);
			q.push(x * 3);
			q.push(x * 2);
		}
	}
	printf("%d\n", x);
	return 0;
}